package com.cgw.dmplt.base.dao.ibatis;

import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.cgw.dmplt.base.domain.BaseRentprice;
import com.cgw.dmplt.base.dao.BaseRentpriceDao;

/**
 * BaseRentpriceDao�ӿ�ʵ����.
 * @author sims autoCoder1.0
 *
 */
public class BaseRentpriceDaoImpl extends SqlMapClientDaoSupport implements BaseRentpriceDao
{
    /**
     * logger.
     */
    private static final Logger logger = Logger.getLogger(BaseRentpriceDaoImpl.class);

    /**
     * �õ�sequence.
     * @return id
     * @throws DataAccessException DataAccessException
     */
    public String getNextId() throws DataAccessException {
    	return (String) getSqlMapClientTemplate().queryForObject("BaseRentprice_getNextId");
    }
    
    /**
     * insert.
     * @param baseRentprice baseRentprice
     * @return id
     * @throws DataAccessException DataAccessException
     */
    public String insertBaseRentprice(BaseRentprice baseRentprice) throws DataAccessException {
		if (logger.isDebugEnabled()) {
    		logger.debug("����insertBaseRentprice(BaseRentprice), �������[" + baseRentprice + "]");
    	}
        
        // �õ�sequence
    	String id = getNextId();
        // todo: set id
        
    	getSqlMapClientTemplate().insert("BaseRentprice_insertBaseRentprice", baseRentprice);
		if (logger.isDebugEnabled()) {
    		logger.debug("�뿪insertBaseRentprice(BaseRentprice), ����[" + id + "]");
		}
    	return id;
    }

    /**
     * delete.
     * @param baseRentprice baseRentprice
     * @throws DataAccessException DataAccessException
     */
    public void deleteBaseRentprice(BaseRentprice baseRentprice)throws DataAccessException {
		if (logger.isDebugEnabled()) {
    		logger.debug("����deleteBaseRentprice(BaseRentprice), �������[" + baseRentprice + "]");
		}
        getSqlMapClientTemplate().update("BaseRentprice_deleteBaseRentprice", baseRentprice);
		if (logger.isDebugEnabled()) {
    		logger.debug("�뿪deleteBaseRentprice(BaseRentprice)");
		}
    }
    
    /**
     * update.
     * @param baseRentprice baseRentprice
     * @throws DataAccessException DataAccessException
     */
    public void updateBaseRentprice(BaseRentprice baseRentprice) throws DataAccessException {
		if (logger.isDebugEnabled()) {
    		logger.debug("����updateBaseRentprice(BaseRentprice), �������[" + baseRentprice + "]");
		}
    	getSqlMapClientTemplate().update("BaseRentprice_updateBaseRentprice", baseRentprice);
		if (logger.isDebugEnabled()) {
    		logger.debug("�뿪updateBaseRentprice(BaseRentprice)");
		}
    }
    
    /**
     * find.
     * @param id id
     * @return baseRentprice
     * @throws DataAccessException DataAccessException
     */
    public BaseRentprice findBaseRentprice(String pk) throws DataAccessException {
		if (logger.isDebugEnabled()) {
        	logger.debug("����findBaseRentprice(BaseRentprice), �������[" + pk + "]");
		}
        BaseRentprice baseRentprice = (BaseRentprice) getSqlMapClientTemplate().queryForObject("BaseRentprice_findBaseRentprice", pk);
		if (logger.isDebugEnabled()) {
        	logger.debug("�뿪findBaseRentprice(BaseRentprice), ����[" + baseRentprice + "]");
		}
        return baseRentprice;
    }
    
    /**
     * list.
     * @param baseRentprice baseRentprice
     * @return baseRentprice list
     * @throws DataAccessException DataAccessException
     */
    public List listBaseRentprice(BaseRentprice baseRentprice) throws DataAccessException {
        List list = getSqlMapClientTemplate().queryForList("BaseRentprice_list", baseRentprice);
        return list;
    }  
    
    /**
     * listCount.
     * @param baseRentprice baseRentprice
     * @return list count
     * @throws DataAccessException DataAccessException
     */
    public Integer listBaseRentpriceCount(BaseRentprice baseRentprice) throws DataAccessException {
		if (logger.isDebugEnabled()) {
        	logger.debug("����listBaseRentpriceCount(BaseRentprice), �������[" + baseRentprice + "]");
		}
        Integer count = (Integer)getSqlMapClientTemplate().queryForObject("BaseRentprice_listBaseRentpriceCount", baseRentprice);
		if (logger.isDebugEnabled()) {
        	logger.debug("�뿪listBaseRentpriceCount(BaseRentprice), ����[" + count + "]");
		}
        return count;
    }  
}
